<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/ceca_two/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/ceca_two/lib/static/h-ui/js/H-ui.min.js"></script>

<script type="text/javascript" src="/ceca_two/lib/jQuery.md5.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript" src="/ceca_two/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/messages_zh.js"></script>

<script type="text/javascript" src="/ceca_two/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/ceca_two/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/ceca_two/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="/ceca_two/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/ceca_two/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/ueditor/1.4.3/ueditor.config.js"></script> 
<script type="text/javascript" src="/ceca_two/lib/ueditor/1.4.3/ueditor.all.js"> </script> 
<script type="text/javascript" src="/ceca_two/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/ceca_two/lib/lightbox2/2.8.1/js/lightbox.min.js"></script>

<!--1.ajaxStart(全局事件)
2.beforeSend
3.ajaxSend(全局事件)
4.success
5.ajaxSuccess(全局事件)
6.error
7.ajaxError (全局事件)
8.complete
9.ajaxComplete(全局事件) 
10.ajaxStop(全局事件)-->
<script>
$.ajaxSetup({
	draw:null,
//	timeout: 200000,
	beforeSend: function (e,xhr) {//发送请求前触发
　　		//xhr.setRequestHeader('userToken', new Date().toLocaleString()); //可以设置自定义标头
　　 },dataFilter:function(data,type){
//	    console.dir(draw);
//	    console.dir(type);
//	    data.draw=draw;
		return data;
    },success: function (data){   //请求成功后触发
		layer.msg(data.mmessage ,{icon:1,time:3000});
	},error: function (xhr, status, e) {  //请求失败遇到异常触发
		layer.msg("请求错误！请稍候重试",{icon:2,time:3000});
	},complete: function (xhr, status) {  //完成请求后触发。即在success或error触发后触发
		console.log("complete"); 
	},
});
var loadingIndex;
$(document).ajaxStart(function() {
 	loadingIndex = layer.load(1, {shade: [0.5,'#fff'] });//0.1透明度的白色背景
}).ajaxStop(function(request) {
  	layer.close(loadingIndex); 
});

function logout(obj){
	$.post("/guidance_service/front/admin/logout.do",{},function(result){
		if(result.resultCode ==200){
 			location.href="/ceca_two/modules/user/login.html?timestamp="+new Date().getTime();
 		}else{
			layer.msg(result.message,{icon:1,time:2000},function(){
				window.location.reload();
			});
 		}
	});
}
$(function(){
	$.post("/guidance_service/front/user/getMyInfo.do",{},function(results){
		if(results.resultCode ==200){
			if(results.data.headImg)$("#headImg").attr("src",results.data.headImg);
			var name = results.data.realName || results.data.userName;
			console.dir(name);
			if(name)$("#name").html(name);
			if(results.data.integral)$("#integral").html(results.data.integral);
			if(results.data.coupons)$("#coupons").html(results.data.coupons);
		}else{
			window.location.href = "/ceca_two/modules/user/login/login.html";
		}
	});
});
</script>
</script>
